<?php
require('config.php');
		$time=time();
        $t1=strtotime(date('Y-m-d 00:00:00',$time));
        $t2=strtotime(date('Y-m-d 08:00:00',$time));
        $t3=strtotime(date('Y-m-d 12:00:00',$time));
        $t4=strtotime(date('Y-m-d 16:00:00',$time));
        $t5=strtotime(date('Y-m-d 20:00:00',$time));
        $t6=strtotime(date('Y-m-d 24:00:00',$time));
        $data[0]['time']='20:00';
        $data[1]['time']='00:00';
        $data[2]['time']='08:00';
        $data[3]['time']='12:00';
        $data[4]['time']='16:00';
        //$data[0]['pan']=-1;
		if($time<$t2 && $time>=$t1)
		{
			// $data[0]['pan']=1;
			// $data[0]['end_time']=$t2;
			$data[0]['status']='0';
			$data[1]['status']='1';
			$data[2]['status']='2';
			$data[3]['status']='2';
			$data[4]['status']='2';
		}
		if($time<$t3 && $time>=$t2)
		{
			// $data[0]['pan']=2;
			// $data[0]['end_time']=$t3;
			$data[0]['status']='2';
			$data[1]['status']='0';
			$data[2]['status']='1';
			$data[3]['status']='2';
			$data[4]['status']='2';
		}
		if($time<$t4 && $time>=$t3)
		{
			// $data[0]['pan']=3;
			// $data[0]['end_time']=$t4;
			$data[0]['status']='2';
			$data[1]['status']='0';
			$data[2]['status']='0';
			$data[3]['status']='1';
			$data[4]['status']='2';
		}
		if($time<$t5 && $time>=$t4)
		{
			// $data[0]['pan']=4;
			// $data[0]['end_time']=$t5;
			$data[0]['status']='2';
			$data[1]['status']='0';
			$data[2]['status']='0';
			$data[3]['status']='0';
			$data[4]['status']='1';
		}
		if($time<$t6 && $time>=$t5)
		{
			// $data[0]['pan']=5;
			// $data[0]['end_time']=$t6;
			$data[0]['status']='1';
			$data[1]['status']='2';
			$data[2]['status']='2';
			$data[3]['status']='2';
			$data[4]['status']='2';
		}
		for($i=0;$i<5;$i++)
		{
			if($data[$i]['status']==0) $data[$i]['title']='已结束';
			if($data[$i]['status']==1) $data[$i]['title']='正在进行';
			if($data[$i]['status']==2) $data[$i]['title']='即将开始';
		}
		$data[0]['end_time']=date('Y-m-d H:i:s',$t6);
		$data[1]['end_time']=date('Y-m-d H:i:s',$t2);
		$data[2]['end_time']=date('Y-m-d H:i:s',$t3);
		$data[3]['end_time']=date('Y-m-d H:i:s',$t4);
		$data[4]['end_time']=date('Y-m-d H:i:s',$t5);
		//$data[0]['time']=$time;
		echo json_encode($data);
?>